//
//  RefreshTableView.h
//  XinDong
//
//  Created by tt on 12-11-9.
//  Copyright (c) 2012年 HengYongKeJi. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "RefreshView.h"
@end

@protocol RefreshTableViewDelegate;
@protocol RefreshTableViewDataSource;

@interface RefreshTableView : UITableView<UIScrollViewDelegate, UITableViewDataSource, UITableViewDelegate, RefreshDelegate>
{
    RefreshView *_headRefreshView;
    BOOL _headRefreshing;
    
    
    UIView *_footerView;
    UILabel *_footerLabel;
    UIActivityIndicatorView *_footerActivityIndicator;
}
@property (nonatomic, assign) BOOL hasMore;
@property (nonatomic, assign) NSInteger dataArrayCount;
@property (nonatomic, assign) RefreshState footerRefreshState;
@property (nonatomic, unsafe_unretained) id <RefreshTableViewDelegate> refreshDelegate;
@property (nonatomic, unsafe_unretained) id <RefreshTableViewDataSource> refreshDataSource;

- (void)doneLoadingTableViewData;
@end

@protocol RefreshTableViewDelegate<NSObject>

@optional
- (void)getUpData;
- (void)getMoreData;

- (CGFloat)heightForRowAtIndexPath:(NSIndexPath *)indexPath;
- (CGFloat)heightForHeaderInSection:(NSInteger)section;
- (CGFloat)heightForFooterInSection:(NSInteger)section;

- (UIView *)viewForHeaderInSection:(NSInteger)section;  
- (UIView *)viewForFooterInSection:(NSInteger)section;

- (void)didSelectRowAtIndexPath:(NSIndexPath *)indexPath;
@end

@protocol RefreshTableViewDataSource<NSObject>

@required
- (NSInteger)numberOfRowsInSection:(NSInteger)section;
- (UITableViewCell *)cellForRowAtIndexPath:(NSIndexPath *)indexPath;

@optional
- (NSInteger)numberOfSectionsInTableView;

- (NSString *)titleForHeaderInSection:(NSInteger)section;    
- (NSString *)titleForFooterInSection:(NSInteger)section;

- (BOOL)canEditRowAtIndexPath:(NSIndexPath *)indexPath;
- (void)commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath*)indexPath;

@end